{block head}
<!-- Colorbox -->
<script type="text/javascript" src="{$basePath}/js/colorbox/jquery.colorbox-min.js"></script>
<link rel="stylesheet" href="{$basePath}/js/colorbox/colorbox.css" type="text/css" media="screen" />

<script type="text/javascript">
    $(document).ready(function() {
        // prekryti hlavniho obrazku 
        $('#detail-image-wrapper').bind('mouseover', showOverlay);        
        $('#detail-image-wrapper').bind('mouseout', hideOverlay);
        function showOverlay() {
            $(this).find('#detail-image-overlay').show();	
        };
        function hideOverlay() {
            $(this).find('#detail-image-overlay').hide();
        };
        
        // gallerie colorbox
        $("a[rel='gallery']").colorbox({ width:"80%", height:"90%" });
    });    
</script>
{/block}

{block content}
{if $estate !== FALSE || $estate->deleted}
<h1 n:block="title">{$estate->title |truncate:65}</h1>
<div id="detail-image-wrapper">
    <img n:foreach="$estate->related('picture')->where('pic_order', 1)->limit(1) as $pic" src="{$basePath}/{$pic->path}" alt="{$pic->description}" />
    <a href="{$basePath}/{$pic->path}" id="detail-image-overlay" rel="gallery"></a>
</div>
<table id="detail-info">
    <tr n:foreach="$info as $name => $value">
        <td>{$name |firstUpper}</td>
        <td>{!$value}</td>
    </tr>    
</table>
<div class="clearfix"></div>

<h2 class="detail-gallery-title">Fotogalerie</h2>
<div class="detail-gallery-item" n:foreach="$estate->related('picture')->where('pic_order > ?', 1) as $pic"> 
    <a href="{$basePath}/{$pic->path}" rel="gallery" title="{$pic->description}">
        <img src="{$basePath}/{? echo Picture::getThumbPath($pic->path)}" alt="nahled {$pic->description}" />
    </a>     
</div>

<h2>Popis</h2>
<p>
    {$estate->description}
</p>

<h2>Realitní poradce</h2>
<p>
    <img src="{$basePath}/{? echo Picture::getThumbPath($agent->picture)}" alt="obrazek maklere" id="detail-agent-pic"/>
    <span id="detail-agent-name">{if $agent->degree !== NULL}{$agent->degree} {/if}{$agent->firstname} {$agent->lastname}</span><br />
    E:mail: <a href="mailto:{$agent->email}">{$agent->email}</a><br />
    Telefon: {? echo AgentModel::formatPhone($agent->phone)}
</p>

{else}
<h1>Nabídka neexistuje</h1>
<p>
    Vámi požadovaná nabídka nebyla v systému nalezena.
</p>
{/if}
{/block}
